#pragma once
#include <vector>

using namespace std;

namespace maxProfit
{
	class Solution {
	public:
		int maxProfit(vector<int>& prices) {
			int size = prices.size();
			if (size == 0)
			{
				return 0;
			}
			int sum = 0;
			int left = 0;
			for (int right = 1; right < size; right++, left++)
			{
				if (prices[right] > prices[left])
				{
					sum += prices[right] - prices[left];
				}
			}
			return sum;
		}
	};
}